//
//  WebViewController.m
//  BCProjectB
//
//  Created by lanou3g on 15/12/17.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "WebViewController.h"
#import <WebKit/WebKit.h>
#import "MBProgressHUD.h"


@interface WebViewController ()<WKNavigationDelegate>
@property(nonatomic,strong)WKWebView *webVeiw;

@end

@implementation WebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
         self.view.backgroundColor=[UIColor whiteColor];
    self.webVeiw =[[WKWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        if (_IsHelp==YES) {
            [MBProgressHUD showHUDAddedTo:_webVeiw animated:YES];
          [self.webVeiw loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:_url]]];

        }else{
    NSString *str=[_url substringFromIndex:17];
    NSString *strUrl=[NSString stringWithFormat:@"http://pianke.me/webview/%@?f=appshare",str];
    [MBProgressHUD showHUDAddedTo:_webVeiw animated:YES];
    [self.webVeiw loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:strUrl]]];
            }
    self.webVeiw.navigationDelegate=self;
    [self.view addSubview:_webVeiw];

}
-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
    [MBProgressHUD hideAllHUDsForView:_webVeiw animated:YES];
}
-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
